export default ({
    state: {
        socket: null,        //ws连接
        opponent_name: "",   //姓名
        opponent_photo: "",  //照片
        status: "matching",  //当前状态,匹配和游戏中[playing、matching]
        game_map: null,      //地图
        //玩家信息
        a_id: 0,
        a_sx: 0,
        a_sy: 0,
        b_id: 0,
        b_sx: 0,
        b_sy: 0,
        gameObject: null,     //存储移动事件信息[move、result]
        loser: "none"         //none、all、A、B
    },
    getters: {},
    mutations: {            //写非异步内容
        updateSocket(state, socket) {
            state.socket = socket;
        },
        updateOpponent(state, opponent) {
            state.opponent_name = opponent.username;
            state.opponent_photo = opponent.photo;
        },
        updateStatus(state, status) {
            state.status = status;
        },
        updateGame(state, game) {
            state.game_map = game.map;
            state.a_id = game.a_id;
            state.a_sx = game.a_sx;
            state.a_sy = game.a_sy;
            state.b_id = game.b_id;
            state.b_sx = game.b_sx;
            state.b_sy = game.b_sy;
        },
        updateGameObject(state, gameObject) {
            state.gameObject = gameObject;
        },
        updateLoser(state, loser) {
            state.loser = loser;
        }

    },
    actions: {},
    modules: {}
})